//
//  NewNickViewController.m
//  NewChat
//
//  Created by 马欢 on 16/2/28.
//  Copyright © 2016年 蓝鸥. All rights reserved.
//

#import "NewNickViewController.h"
#import "MyDataViewController.h"
#import "MyCenterViewController.h"

@interface NewNickViewController ()
@property (nonatomic,strong)UITextField *NewNick;
@end

@implementation NewNickViewController

- (void)viewDidLoad {
    [super viewDidLoad];
    // Do any additional setup after loading the view.
    self.view.backgroundColor = [UIColor colorWithPatternImage:[UIImage imageNamed:@"0.jpg"]];
    self.edgesForExtendedLayout = UIRectEdgeNone;
    self.title = @"修改昵称";
    self.navigationItem.leftBarButtonItem = [[UIBarButtonItem alloc]initWithTitle:@"取消" style:(UIBarButtonItemStylePlain) target:self action:@selector(backAction)];
    self.navigationItem.rightBarButtonItem = [[UIBarButtonItem alloc]initWithTitle:@"保存" style:(UIBarButtonItemStylePlain) target:self action:@selector(saveAction)];
    
    self.NewNick = [[UITextField alloc]initWithFrame:CGRectMake(0, 0, [UIScreen mainScreen].bounds.size.width, 50)];
    self.NewNick.backgroundColor = [UIColor whiteColor];
    self.NewNick.placeholder = @"     请输入新昵称";
    [self.view addSubview:self.NewNick];
}

-(void)backAction{
    [self.navigationController popViewControllerAnimated:YES];
}

-(void)saveAction{
    [MyDataViewController sharedMyDataViewController].myNick = self.NewNick.text;
    [[MyDataViewController sharedMyDataViewController].myDataTV reloadData];
//    将新昵称 加入数据库？？？？？？？？
    [self backAction];
}
- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}


@end
